package org.phmanago.gui;

import java.awt.Container;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.TreeSelectionListener;

//import net.sourceforge.mlf.metouia.MetouiaLookAndFeel;

import org.phmanago.core.*;
import org.phmanago.test.*;

public class PhManagoFrame extends JFrame {
	private ControlsPanel cPanel = null;
	private StructurePanel phPanel = null;
	private SettingsPanel sPanel1 = null;
	private SettingsPanel sPanel2 = null;
	private DirTree fPanel = null;
	private DirPanel imgPanel = null;
	
	public PhManagoFrame() {
		
		/*try {
            UIManager.setLookAndFeel(new MetouiaLookAndFeel());
        } catch (UnsupportedLookAndFeelException ex) {
            System.out.println("Using default look and feel");
        }*/

		
		Container content = getContentPane();
		content.setLayout(new BoxLayout(content, BoxLayout.X_AXIS));
		JPanel hContent = new JPanel();
		hContent.setLayout(new BoxLayout(hContent, BoxLayout.Y_AXIS));
		
		cPanel = new ControlsPanel();
		phPanel = new StructurePanel();
		sPanel1 = new SettingsPanel();
		sPanel2 = new SettingsPanel();
		imgPanel = new DirPanel();
		imgPanel.changed(null);
		fPanel = new DirTree(imgPanel);
	
		JPanel fsPanel = new JPanel();
		fsPanel.setLayout(new BoxLayout(fsPanel, BoxLayout.X_AXIS));
		fsPanel.add(fPanel);
		fsPanel.add(new JScrollPane(imgPanel));
		
		JTabbedPane tabbedPane = new JTabbedPane();
		tabbedPane.addTab("Photos", null, sPanel1, "Does nothing");
		tabbedPane.addTab("Settings", null, sPanel2, "Does nothing");
		tabbedPane.addTab("Files", null, fsPanel, "Selects files");
		hContent.add(phPanel);
		hContent.add(cPanel);
		
		content.add(hContent);

		content.add(tabbedPane);
		
        this.pack();
        
		this.setTitle("Photo Manago v.0.0001 (pre-alpha)");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        this.setSize(700,600);
        this.setVisible(true);
        this.setResizable(false);
	}
	
	public void setModel(Album a) {
		phPanel.setModel(a);
	}
	
	/*public void addTreeSelectionListener(TreeSelectionListener tsl){
		phPanel.addTreeSelectionListener(tsl);
	}*/
}
